﻿(function() {
    $(function() {
        var _releaseRecordService = abp.services.app.releaseRecord;


        $('#RefreshButton').click(function () {
            refreshUserList();
        });

        $('.btn-feedback').click(function () {
            var releaselogid = $(this).attr("data-feedback-releaselogid");
            location.href = abp.appPath + 'ReleaseRecord/Feedbacks?releaselogid=' + releaselogid;
        });

        $('.badge-feedbacktotal').each(function () {
            var $othis = $(this);
            var releaselogid = $(this).attr("data-releaselogid");

            _releaseRecordService.getFeedbackStatics({ releaseLogId: releaselogid}).done(function (res) {
                var $_othis = $othis;
                $_othis.find('.badge-feedbacktotal-pending').text(res.pendingTotal);
                $_othis.find('.badge-feedbacktotal-claimed').text(res.claimedTotal);
                $_othis.find('.badge-feedbacktotal-processing').text(res.processingTotal);
                $_othis.find('.badge-feedbacktotal-processed').text(res.processedTotal);
            });

        });

        //初始化分页
        $.paginationInit($('.pagination'), '', 7);

        function refreshUserList() {
            location.reload(true); //reload page to see new user!
        }

    });
})();
